import java.io.File;
import java.util.Scanner;
// 文件练习
public class Demo6 {
    //重命名文件名
    public static void main(String[] args) throws Exception  {
        File file1=new File("./text.txt");
        
        if(!file1.exists()){
            file1.createNewFile();
        }
        System.out.println("输入任意值继续");
        Scanner scanner=new Scanner(System.in);
        scanner.nextLine();
        File file2=new File("./text2.txt");
             
        file1.renameTo(file2);
        
    }

}
